﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="Edit.aspx.cs" Inherits="MVCClubSite.Web.Views.UserProfiles.Edit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentblock">
        <h2>
            My Profile</h2>
        <% using (Html.BeginForm("Edit", "UserProfiles",  FormMethod.Post, new { @enctype = "multipart/form-data" }))
           { %>
           <%=Html.Hidden("userID", ViewData.Model.UserProfile.UserID) %>
        <table>
            <tr>
                <td colspan='2' class="tableheader">
                    Site Preferences
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.Label("newsletter", "Newsletter:") %>
                </td>
                <td>
                    <select name="newsletter" id="newsletter">
                        <% if (ViewData.Model.UserProfile.Newsletter)
                           {
                               Response.Write("<option value='false'>No</option>");
                               Response.Write("<option selected='selected' value='true'>Yes</option>");
                           }
                           else
                           {
                               Response.Write("<option selected='selected' value='false'>No</option>");
                               Response.Write("<option value='true'>Yes</option>");
                           }%>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan='2' class="tableheader">
                    Personal Details
                </td>
            </tr>
            <tr>
                <td>
                    <%=Html.Label("firstname", "First Name:") %>
                </td>
                <td>
                    <%= Html.TextBox("firstname", ViewData.Model.UserProfile.FirstName)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%=Html.Label("lastname", "Last Name:") %>
                </td>
                <td>
                    <%= Html.TextBox("lastname", ViewData.Model.UserProfile.LastName)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%=Html.Label("address", "Address:") %>
                </td>
                <td>
                    <%= Html.TextBox("address", ViewData.Model.UserProfile.Address)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%=Html.Label("phone", "Phone:") %>
                </td>
                <td>
                    <%= Html.TextBox("phone", ViewData.Model.UserProfile.Phone)%>
                </td>
            </tr>
            <tr>
                <td colspan='2' class="tableheader">
                    Forum Information
                </td>
            </tr>
            <tr>
                <td>
                    <%=Html.Label("avatar", "Avatar:") %>
                </td>
                <td>
                    <input type="file" name="avatar" size="40" />
                </td>
            </tr>
            <% if (ViewData.Model.UserProfile.Avatar != null)
               {
                   Response.Write("<tr><td></td><td>");
                   Response.Write(Html.Image("~/Images/Avatar/" + ViewData.Model.UserProfile.UserID));
                   Response.Write(Html.ActionLink("Delete Current Avatar", "DeleteAvatar", "UserProfiles"));
                   Response.Write("</td></tr>");
               }
            %>
            </td> </tr>
            <tr>
                <td style="vertical-align: top;">
                    <%=Html.Label("signature", "Signature:") %>
                </td>
                <td>
                    <%= Html.TextArea("signature", ViewData.Model.UserProfile.Signature) %>
                </td>
            </tr>
            <tr>
                <td style="vertical-align: top;">
                    <%=Html.Label("bio", "Bio:") %>
                </td>
                <td>
                    <%= Html.TextArea("bio",ViewData.Model.UserProfile.Bio)%>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td style="text-align: left;">
                    <input type="submit" name="submit" value="Save" />
                </td>
            </tr>
        </table>
        <%} %>
    </div>

    <script type="text/javascript" src="<%=AppHelper.JavascriptUrl("tinymce/tiny_mce.js") %>"></script>

    <script type="text/javascript" src="<%=AppHelper.JavascriptUrl("tinymce/advanced_config.js") %>"></script>

</asp:Content>
